def add(*args):
    sum = 0

    for i in args[0]:
        sum += i
    print("和为{}".format(sum))
def jianfa():
    a = int(input("第一个数："))
    b = int(input("第二个数："))
    print("差为：{}".format(a-b))
def chengfa():
    sum = 1
    nums = []
    while True:
        num = input("输入数字：")
        if num == 'quit':
            break
        else:
            nums.append(int(num))
    for i in nums:
        sum *= i
    print("结果为：{}".format(sum))
def chufa():
    while True:
        a =input("第一个数")
        if a == 'quit':
            break
        else:
            b = input("第二个数：")
            if b == 'quit':
                break
            else:
                if int(b) == 0:
                    print("第二个数不能为0")
                else:
                    print("结果为：".format(int(a) / int(b)))


while True:

    print("1.加法\n2.减法\n3.乘法\n4.除法\n5退出\n")
    button = int(input("输入你想要实现的功能"))
    if button == 1:
        sum = 0
        nums = []
        while True:
            num = input("输入数字：")
            if num == 'quit':
                break
            else:
                nums.append(int(num))

        add(nums)
    elif button == 2:
        jianfa()
    elif button == 3:
        chengfa()
    elif button == 4:
        chufa()
    elif button == 5:
        print("exit")
        break